/*
 * Context.h
 *
 *  Created on: Aug 5, 2009
 *      Author: ramesh
 */

#ifndef _COMPOSER_CONTEXT_H_
#define _COMPOSER_CONTEXT_H_

#include "Variable.h"
#include "Node.h"

#include "../../Shared.h"


namespace SymphonyAST {


class Context : public Node {
private:
	vector<Context*> children;

protected:
	map<string, Variable*> varTable;
	StackPointer offset;

public:
	Context();

	Variable* getVariable(const string& name);

	virtual void addVariable(string name, Variable* variable);

	void addChild(Context* node);
	Context* removeChild(int i);

	vector<Context*> getChildren();
	void clearChildren();

	Context* getChild(int i);

	void setChild(int i, Context* child);
	void setChildren(vector<Context*>& children);

	StackPointer getOffset();

	void setOffset(StackPointer offset);

	StackPointer getAbsOffset();

	void incOffset(StackPointer inc);
	void decOffset(StackPointer dec);
};


}

#endif /* _COMPOSER_CONTEXT_H_ */
